package com.itheima.mapper;

import com.itheima.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {
    @Insert("insert into student values (id,#{name},#{sex},#{age},#{address},#{qq},#{email})")
    void add(Student stu);

    @Select("select count(*) from student")
    int findCount();

    @Select("select * from student limit #{current},#{size}")
    List<Student> findPages(@Param("current") Integer current, @Param("size") Integer size);

    @Select("select * from student where id = #{id}")
    Student findById(int id);

    @Delete("delete from student  where id = #{id}")
    void delete(int id);

    @Update("update student set name = #{name},sex = #{sex},age = #{age},address = #{address},qq = #{qq},email = #{email} where id = #{id}")
    void update(Student stu);
}
